$(function(){
	showRecordList();
	
	 //添加表格行单击事件
	/*$("#recordTable tbody tr").bind("click",function(){
		showRecordInfo();
	});*/
});

function getRootPath(){
    var curWwwPath=window.document.location.href;
    var pathName=window.document.location.pathname;
    var pos=curWwwPath.indexOf(pathName);
    var localhostPaht=curWwwPath.substring(0,pos);
    var projectName=pathName.substring(0,pathName.substr(1).indexOf('/')+1);
    return(localhostPaht);
}



$("#pbFile").fileinput({
    showPreview : false,
    uploadUrl: getRootPath() + '/record/upload', //上传的地址
    allowedFileExtensions : [ "xls", "xlsx" ], //限制文件类型
    elErrorContainer : "#fileError",
    browseClass : "btn btn-success",
    browseLabel : "查找文件",
    browseIcon : '<i ></i>',
    removeClass : "btn btn-danger",
    removeLabel : "删除",
    removeIcon : '<i ></i>',
    uploadClass : "btn btn-info",
    uploadLabel : "上传",
    uploadIcon : '<i ></i>',
});


//展示交易列表
function showRecordList(){
	$("#recordList").html("");
	$.ajax({
		url : getRootPath() + "/record/records",
		dataType : "html",
		success : function(data){
			$("#recordList").html(data);
		},
		error : function(data){
			alert("error");
		}
	});
}

$('#refButton').click(function(){
	showRecordList();
});
$('#thisMonth').click(function(){
	
})

function showRecordInfo(){
	$("#recordInfoModal").modal("show");
}

